<template>
</template>

<script>
	export default {
		data() {
			return {
				userInfo: {}
			}
		},
		onShow() {
			this.checkLoginStatus()
			if(this.userInfo.userType === 0){
				uni.redirectTo({
				    url:'/pages/application/studentSickapply'
			})}else{
				uni.redirectTo({
					url:'/pages/application/teacherapply'
			})}
		},
		methods: {
			// 检查登录状态
			checkLoginStatus() {
				const userInfo = uni.getStorageSync('userInfo')
				if (!userInfo) {
					uni.redirectTo({ url: '/pages/login/login' })
					return
				}
				this.userInfo = {
					name: userInfo.name,
					userId: userInfo.id,
					role: userInfo.roleName,
					userType: userInfo.type || 0 // 0学生 2教师
			    }
			},
		}
	}
</script>

<style>
</style>